<?php
session_start();
require '../config.php';
error_reporting(5);
error_reporting(E_ALL & ~E_NOTICE);
error_reporting(0);

$email=$_POST['email'];
$phone=$_POST['uphone'];
$pub_time=Date('Y-m-d H:i:s');



$query="SELECT * FROM users WHERE `uemail`='$email'";
     $result = mysqli_query($config,$query);
     if ($result) {
     	$row=mysqli_fetch_array($result,MYSQLI_ASSOC);
          // var_dump($row['userid']);
     	if ($row) {
     		$query="INSERT INTO forget(`forgetid`,`email`,`f_phone`,`pub_time`,`state`) VALUES('".$row['userid']."','$email','$phone','$pub_time','1')";
$result = mysqli_query($config,$query)or die("error:".mysqli_error());
// echo $query;
if ($result) {
     echo ('<script type="text/javascript">alert("申请成功");
          window.location.href = "index.php";
          </script>');
}else{
     echo('<script type="text/javascript">alert("申请失败");
          </script>');
}

     	}
        else{
          echo ('<script type="text/javascript">alert("邮箱未被注册！请注册");
                    window.history.back(-1);
                    </script>');









}


     }
     ?>
